﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework2
{
    internal class Square:IShape
    {
        public double Side { get; set; }

        public Square(double side)
        {
            this.Side = side;
        }

        public double Area
        {
            get
            {
                if (!isValid())
                    throw new InvalidOperationException("正方形边长无效，无法计算");
                return Side * Side;
            }
        }

        public bool isValid()
        {
            return Side > 0;
        }

        public string information => $"Square[side:{Side}]";
    }
}
